package com.jie.web.controller;


import com.jie.dto.GroupDTO;
import com.jie.service.GroupImService;
import com.jie.vo.CommonResponse;
import com.jie.vo.GroupImVO;
import com.jie.vo.GroupInviteVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 群管理模块
 * @author xiaojie
 * @since 2023-11-01
 */
@RestController
@RequestMapping("/group")
@Api(tags = "群管理模块")
public class GroupImController {

    @Autowired
    private GroupImService groupImService;
    @ApiOperation(value = "创建群聊",notes="创建群聊")
    @PostMapping("/create")
    public CommonResponse<GroupDTO> createGroup(@Valid @RequestBody GroupImVO vo){
        return CommonResponse.buildSuccess(groupImService.createGroup(vo));
    }
    @ApiOperation(value = "邀请进群",notes="邀请好友进群")
    @PostMapping("/invite")
    public CommonResponse invite(@Valid  @RequestBody GroupInviteVO vo){
        groupImService.invite(vo);
        return CommonResponse.buildSuccess();
    }
}

